package com.cloud.xtools.user.domain.request.admin;

import com.cloud.xtools.common.validator.annotation.FieldUnique;
import com.cloud.xtools.user.domain.entity.User;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author Daixinguo
 */
@Data
public class UserRegisterRequest {
    // 用户名
    @NotBlank
    private String name;
    // 账号
    @NotBlank
    @FieldUnique(entity = User.class, field = "username", message = "当前账号已经被注册")
    private String username;
    // 手机号
    @NotBlank
    @FieldUnique(entity = User.class, field = "mobile", message = "当前手机号码已经被注册")
    public String mobile;
    // 邮箱
    @NotBlank
    @FieldUnique(entity = User.class, field = "email", message = "当前邮箱已经被注册")
    @Email
    private String email;
    // 密码
    @NotBlank
    @Size(min = 6, max = 16)
    private String password;
    // 是否为管理员
    private Boolean admin;
    // 创建时间
    private final LocalDateTime createdAt = LocalDateTime.now();
    private final LocalDateTime updatedAt = LocalDateTime.now();
}
